<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>3D呈现transform-style</title>
  <style>
    body {
      /* 给需要做透视盒子的父盒子加透视：视距 */
      perspective: 500px;
    }

    .box {
      position: relative;
      width: 200px;
      height: 200px;
      margin: 100px auto;

      transition: all 1.2s;

      /* transform-style: flat 默认子元素不开启3d空间 */
      /* preserve-3d 开启3d空间 */
      transform-style: preserve-3d;
    }


    .box div {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: pink;


    }

    .box div:last-child {
      background-color: purple;
      transform: rotateX(60deg);
    }

    .box:hover {
      transform: rotateY(60deg);
    }
  </style>
</head>

<body>

  <div class="box">
    <div></div>
    <div></div>
  </div>

</body>

</html>